# Contributor: Peter Shkenev <santurysim@gmail.com>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=gajim
pkgver=1.8.2
pkgrel=0
_pkgver_suffix=""
pkgdesc="A full featured and easy to use XMPP client"
url="https://gajim.org/"
arch="noarch"
license="GPL-3.0-only"
depends="
	dbus
	gtk+3.0
	gtksourceview4
	libsoup3
	py3-cairo
	py3-css-parser
	py3-gobject3
	py3-keyring
	py3-nbxmpp
	py3-omemo-dr
	py3-openssl
	py3-packaging
	py3-pillow
	py3-precis-i18n
	py3-qrcode
	sqlite
	pango
	"
makedepends="
	gettext-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="xvfb-run font-dejavu"
source="
	https://gajim.org/downloads/${pkgver:0:3}/gajim-$pkgver$_pkgver_suffix.tar.gz
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pyc"

build() {
	./pep517build/build_metadata.py -o .dist/metadata
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	xvfb-run -a .testenv/bin/python3 -m unittest discover -s test
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	./pep517build/install_metadata.py .dist/metadata --prefix="$pkgdir"/usr
}

lang() {
	pkgdesc="Languages for package $pkgname"
	amove usr/lib/python3*/site-packages/gajim/data/locale
}

sha512sums="
ad422084433183af0db3d658810630e11dcdef91042621f8f7bea8b289f5d37e8ea381d6d6150a404b97bba7e6a4c2843b435ab4421aca64ae8d3a05aa52c73f  gajim-1.8.2.tar.gz
"
